<?php
/**
 * Created by PhpStorm.
 * User: ruma
 * Date: 2019/1/18
 * Time: 7:12
 */

namespace app\admin\controller;


use app\admin\model\Login as LoginModel;
use app\common\controller\AdminBaseController;
use app\Excepiton\ParameterException;

class Login extends AdminBaseController
{
    //用户登陆
    public function login(){
        if (IS_POST){
            try{
                (new LoginModel())->checkAdmin();
            }
            catch(ParameterException $e){
                $str = arrayToString($e->msg);
                $this->error('登陆失败!'.$str);
            }
            $this->success('登陆成功', 'admin/Index/index');
        }
        else{
            return $this->fetch();
        }
    }
}

